React = require('react')
Card = require('antd-mobile/lib/card')
# ListView = require('antd-mobile/lib/list-view')
Flex = require('antd-mobile/lib/flex')
Icon = require('antd-mobile/lib/icon')
Toast = require('antd-mobile/lib/toast')
RefreshControl = require('antd-mobile/lib/refresh-control')
TopNotice = require('antd-mobile/lib/notice-bar')
{StyleSheet,WebView,Image,Text,ScrollView,TouchableHighlight,StyleSheet,Navigator,ListView,ActivityIndicator,TouchableOpacity} = require('react-native')
Dimensions = require('Dimensions')
{ width, height } = Dimensions.get('window')
{View} = require('react-native')
{fetchGetList,fetchRefreshList} = require('../actions/page_planDetail.js')
{connect} = require('react-redux')
_ = require('underscore')
moment = require('moment')
backImg = require('../img/back.png')

Page_bwss_detail = React.createClass
  componentDidMount:->
  _processTime:(time)->
    t = moment(time)
    t.format('YYYY-MM-DD')
  render:->
    model = @props.model
    <View style={width:width,height:height,flexDirection:'column'}>
      <View style={{flexDirection:'row',flex:0,height:60,alignItems:'center', justifyContent:'center',backgroundColor:'#0066FF'}}>
        <View style={{flex:1,padding:10}}>
          <TouchableOpacity onPress={=>@props.navigator.pop()}>
            <Image source={backImg}  style={{height:30,width:30,resizeMode:'contain'}}/>
          </TouchableOpacity>
        </View>
        <View style={{flex:3,justifyContent:'center',alignItems:'center'}}>
          <Text style={{fontSize:20,color:'#ffffff'}}>{model.VCPLACENAME}</Text>
        </View>
        <View style={{flex:1,alignItems:'flex-end',padding:10}}>
        </View>
      </View>

      <ScrollView style={{backgroundColor:'#fffff0',paddingTop:10,height:height-80}}>
        <View style={{flexDirection:'column',marginBottom:10}}>
          <View style={styles.row}>
            <View style={styles.cell}>
              <Text style={styles.text}>泊位名称</Text>
              <Text style={styles.text}>{model.VCPLACENAME}</Text>
            </View>
            <View style={styles.cell}>
              <Text style={styles.text}>泊位简称</Text>
              <Text style={styles.text}>{model.VCPLACESNAME}</Text>
            </View>
          </View>
          <View style={styles.row}>
            <View style={styles.cell}>
              <Text style={styles.text}>海里</Text>
              <Text style={styles.text}>{model.NMSEAMILES}</Text>
            </View>
            <View style={styles.cell}>
              <Text style={styles.text}>地点标志</Text>
              <Text style={styles.text}>{if model.CHPLACEFLAG is '0' then '吴淞口内' else '吴淞口外'}</Text>
            </View>
          </View>
          <View style={styles.row}>
            <View style={styles.cell}>
              <Text style={styles.text}>计费区间</Text>
              <Text style={styles.text}>{model.CHFEE}</Text>
            </View>
            <View style={styles.cell}>
              <Text style={styles.text}>港区</Text>
              <Text style={styles.text}>{model.GQNAME}</Text>
            </View>
          </View>
          <View style={styles.row}>
            <View style={styles.cell}>
              <Text style={styles.text}>码头</Text>
              <Text style={styles.text}>{model.MTNAME}</Text>
            </View>
            <View style={styles.cell}>
              <Text style={styles.text}>泊位水深</Text>
              <Text style={styles.text}>{model.NMWATERLEN}</Text>
            </View>
          </View>
          <View style={styles.row}>
            <View style={styles.cell}>
              <Text style={styles.text}>泊位性质</Text>
              <Text style={styles.text}>{model.XZNAME}</Text>
            </View>
            <View style={styles.cell}>
              <Text style={styles.text}>使用标志</Text>
              <Text style={styles.text}>{if model.CHUSEFLAG is '1' then '正在使用' else '停止使用'}</Text>
            </View>
          </View>
        </View>
      </ScrollView>
    </View>


styles = StyleSheet.create
  row:
    flexDirection:'row'
    borderWidth:1
    borderStyle:'solid'
    borderColor:'#CCCCCC'
    backgroundColor:'#ffffff'
    padding:10
    marginLeft:10
    marginRight:10
  cell:
    flex:1
    flexDirection:'row'
  text:
    flex:1

mapStateToProps = (state)->
  connected:state.appState.connected

module.exports = connect(mapStateToProps)(Page_bwss_detail)
